<link rel="stylesheet" type="text/css" href="css/layout_master_page.css" />
<link rel="stylesheet" type="text/css" href="css/layout.css" />
<?php
	/*Hàm giới hạn chữ khi hiển thị*/
	function cut($str, $len) 
	{
		$str = trim($str);
		if (strlen($str) <= $len) return $str;
		$str = substr($str, 0, $len);
		if ($str != "") {
			if (!substr_count($str, " ")) return $str." ...";
			while (strlen($str) && ($str[strlen($str) - 1] != " ")) $str = substr($str, 0, -1);
			$str = substr($str, 0, -1)." ...";
		}
		return $str;
	}	
?>
<div class="detail-cat">
<?php
	@$id_cat = $_GET['id_type'];
	include_once('libs/htdu_core.php');
	$exe_mysql = new execute_mysql_query();
	//$result = $exe_mysql->execute("select * from node where id = $id_cat",0);
	$result = $exe_mysql->execute("select nt.id, name, n.id, img, id_type, note, title, description, date from node n, node_type nt where id_type = $id_cat and nt.id = $id_cat order by date desc",0);
	while($row = mysql_fetch_array($result))
	{
		$func = new global_function();
		$cat = $func->remove_sign($row["name"]);
		$title = $func->remove_sign($row["title"]);
		echo '<div class="detail-cat-img-title">';
			echo '<div>'.'<a href="'.$cat.'/'.$title.'/'.$row['id_type'].'/'.$row['id'].'.html" class="link-more">'.'<img src="'.$row['img'].'" id="img" alt="'.$row['title'].'" title="'.$row['title'].'" />'.'</a>'.'</div>';
			echo '<div class="detail-cat-title">'.'<a href="'.$cat.'/'.$title.'/'.$row['id_type'].'/'.$row['id'].'.html" class="link-more">'.cut($row['title'],150).'</a>'.'</div>';
			echo '<div class="detail-cat-content">'.cut($row['description'],230).'</div>';
			echo '<div class="view-more">'.'<a href="'.$cat.'/'.$title.'/'.$row['id_type'].'/'.$row['id'].'.html" class="link-more">'."Xem tiếp>>".'</a>'.'</div>';
		echo '</div>';
	}
?>
</div>








